/*
 * @Description: 产品接口
 * @Author: lwx
 * @Date: 2021-11-16 16:17:27
 * @LastEditors: lwx
 * @LastEditTime: 2023-04-12 11:29:43
 */
import request from '@/utils/request'

/* 获取产品列表 */
export function productList(page) {
    return request({
        url: '/product',
        method: 'GET',
        params: page
    })
}


/* 新增产品 */
export function addProduct(data) {
    return request({
        url: '/product',
        method: 'POST',
        data
    })
}
/* 修改产品 */
export function updateProduct(data) {
    return request({
        url: '/product',
        method: 'PUT',
        data
    })
}
/* 删除产品 */
export function removeProduct(product_id) {
    return request({
        url: '/product',
        method: 'DELETE',
        data: {
            product_id
        }
    })
}

/* 上传sop */
export function uploadSop(data) {
    return request({
        contentType: false,
        headers: { 'Content-Type': 'multipart/form-data' },
        url: '/sop/upload',
        method: 'POST',
        data: data
    })
}

/* 下载sop */
export function downloadSop(product_id) {
    return request({
        url: '/sop/download',
        method: 'GET',
        params: { product_id },
        responseType: 'blob'
    })
}